class Command

	attr_accessor :switches, :separator, :binName

	def initialize(binName, switches)
	
		@binName = binName
		@switches = switches
		@separator = " "
	
	end
	

	def createCommandString
	
		str = []
	
		@switches.each{|switch|
			if switch.used == true
				str << switch.switch + getStringOfDataFormatValue(switch.dataFormat)
			end
		}

		return @binName + @separator + str.join(@separator)
		
	end
	
	def getStringOfDataFormatValue(data)
		if data.class == Array
			ret = ""
			data.each{|element|
				ret += getStringOfDataFormatValue(element)
			}
			return ret
		else
			
			if data.datatype == DataTypes::INT
				return data.value.to_i.to_s
			elsif data.datatype == DataTypes::FLOAT
				return data.value.to_f.to_s
			elsif data.datatype == DataTypes::STRING
				return data.value.to_s
			end
			
		end
	end


end
